// Work Order列表中添加查看质量报表按钮
frappe.listview_settings['Work Order'] = frappe.listview_settings['Work Order'] || {};

// 保存原始的onload函数
var original_onload = frappe.listview_settings['Work Order'].onload;

frappe.listview_settings['Work Order'].onload = function(listview) {
    // 调用原始onload函数
    if(original_onload) {
        original_onload(listview);
    }
    
    // 添加自定义按钮
    listview.page.add_menu_item(__("查看质量报表"), function() {
        frappe.set_route('query-report', 'MES Quality Inspection Data Report');
    });
};
